package com.hyopt.modules.app.controller;

import com.hyopt.common.utils.MD5Util;
import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * @ClassName MD5Demo
 * @Description TODO
 * @Author lijie
 * @Date 2023/3/14 15:19 星期二
 * @Version 1.0
 */
@Slf4j
public class MD5Demo {

    public static void main(String[] args) {
        // 获取签名
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String time = sdf.format(new Date());
        String body = "{\"token\":\"1676276575000001-OPEN-b0bdf3a33cb24c81b39962f44286df71\"}";
        String unSignStr =  body + "_" + time ;
        log.info("未加签:{}" , unSignStr);
        String signStr = MD5Util.MD5(unSignStr).toUpperCase(Locale.ROOT);
        log.info("已加签:{}" ,  signStr);
    }

}
